package com.ruoyi.web.controller.dgw;

import java.util.List;

import com.ruoyi.common.utils.HttpClientUtil;
import com.ruoyi.common.utils.spring.EncryptUtil;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.dgw.domain.BankManager;
import com.ruoyi.dgw.service.IBankManagerService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 银行管理Controller
 * 
 * @author ruoyi
 * @date 2021-11-23
 */
@RestController
@RequestMapping("/dgw/manager")
public class BankManagerController extends BaseController
{
    @Autowired
    private IBankManagerService bankManagerService;

    /**
     * 查询银行管理列表
     */
    @PreAuthorize("@ss.hasPermi('dgw:manager:list')")
    @GetMapping("/list")
    public TableDataInfo list(BankManager bankManager)
    {
        bankManager.setUserId(getUserId());
        startPage();
        List<BankManager> list = bankManagerService.selectBankManagerList(bankManager);
        return getDataTable(list);
    }

    /**
     * 导出银行管理列表
     */
    @PreAuthorize("@ss.hasPermi('dgw:manager:export')")
    @Log(title = "银行管理", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(BankManager bankManager)
    {
        List<BankManager> list = bankManagerService.selectBankManagerList(bankManager);
        ExcelUtil<BankManager> util = new ExcelUtil<BankManager>(BankManager.class);
        return util.exportExcel(list, "银行管理数据");
    }

    /**
     * 获取银行管理详细信息
     */
    @PreAuthorize("@ss.hasPermi('dgw:manager:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(bankManagerService.selectBankManagerById(id));
    }

    /**
     * 新增银行管理
     */
    @PreAuthorize("@ss.hasPermi('dgw:manager:add')")
    @Log(title = "银行管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BankManager bankManager)
    {
        return toAjax(bankManagerService.insertBankManager(bankManager));
    }

    /**
     * 修改银行管理
     */
    @PreAuthorize("@ss.hasPermi('dgw:manager:edit')")
    @Log(title = "银行管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BankManager bankManager)
    {
        return toAjax(bankManagerService.updateBankManager(bankManager));
    }

    /**
     * 删除银行管理
     */
    @PreAuthorize("@ss.hasPermi('dgw:manager:remove')")
    @Log(title = "银行管理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(bankManagerService.deleteBankManagerByIds(ids));
    }


}
